package com.zone.vehicle.superApps.view.appmanager.adapter;

import android.content.Context;
import android.content.res.TypedArray;

import com.zone.vehicle.lib.view.VerticalTabLayout;
import com.zone.vehicle.superApps.R;

public class TabAdapter implements VerticalTabLayout.ViewPagerTabItemCreator {

    private VerticalTabLayout layout;

    private TypedArray tab_icon;
    private TypedArray tab_icon_checked;
    private String[] tab_title;

    public TabAdapter(Context context, VerticalTabLayout layout){
        this.layout = layout;
        tab_icon = context.getResources().obtainTypedArray(R.array.tab_icon);
        tab_icon_checked = context.getResources().obtainTypedArray(R.array.tab_icon_checked);
        tab_title = context.getResources().getStringArray(R.array.tab_title);
    }

    @Override
    public VerticalTabLayout.VerticalTab create(int position) {
        VerticalTabLayout.VerticalTab tab = layout.newTab();
        tab.setIcon(tab_icon_checked.getDrawable(position));
        tab.setText(tab_title[position]);
//        switch (position){
//            case 0:
//                tab.setIcon(R.drawable.ic_launcher_foreground);
//                tab.setText("登录");
//                break;
//            case 1:
//                tab.setIcon(R.drawable.ic_launcher_foreground);
//                tab.setText("设置");
//                break;
//            case 2:
//                tab.setIcon(R.drawable.ic_launcher_foreground);
//                tab.setText("应用");
//                break;
//            case 3:
//                tab.setIcon(R.drawable.ic_launcher_foreground);
//                tab.setText("主页");
//                break;
//        }
        return tab;
    }

}
